<!--
 * @Author: sxb
 * @Email: sxb@mail.com
 * @Date: 2020-11-30 16:14:53
 * @Descripttion: 
-->
<template>
  <div>
    <avue-crud
      ref="crud"
      :option="tableOption"
      :data="list"
      :table-loading="listLoading"
      @on-load="getList"
      @refresh-change="refreshChange"
    ></avue-crud>
  </div>
</template>

<script>
import { watchSizeApi } from "@/api/platProduct/management";
import { tableOption } from "@/const/crud/platProduct/product-watchSizeList";
export default {
  name: "watchSizeList",
  data() {
    return {
      tableOption: tableOption,
      list: [],
      listLoading: false,
    };
  },
  props: {
    Id: {
      type: String,
      default: "",
      required: true,
    },
  },
  watch: {
    Id(newValue, oldValue) {
      if (newValue) {
        this.list = [];
        this.getList();
      }
    },
  },
  methods: {
    getList() {
      let Id = {
        Id: this.Id,
      };
      this.listLoading = true;
      watchSizeApi(Id).then((res) => {
        console.log(res);
        if (res.status == 200) {
          if (res.data.code == 0) {
            this.list = res.data.data;
            this.listLoading = false;
          }
        }
      }).catch(error=>{
        console.log(error);
        this.listLoading = false;
      });
    },
    refreshChange() {
      this.getList();
    },
  },
  mounted() {},
};
</script>

<style lang="scss" scoped>
</style>